package com.example.lx6_8.cate

import androidx.lifecycle.MutableLiveData
import com.example.base.aa.entity.CateEntity
import com.example.base.aa.entity.CateEntityItem
import com.example.base.aa.entity.GoodsEntity
import com.example.base.aa.mvvm.BaseViewModel
import com.example.base.aa.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import retrofit2.http.Query
import javax.inject.Inject

@HiltViewModel
class CateViewModel @Inject constructor(val apiService: ApiService) : BaseViewModel() {

    val cateData = MutableLiveData<CateEntity>()

    fun getCate(){
        httpRequest({apiService.getCate()},cateData::postValue)
    }

    val goodsData = MutableLiveData<GoodsEntity>()

    fun getGoods(cid:Int,limit:Int,page:Int){
        httpRequest({apiService.getGoods(cid, limit, page)},goodsData::postValue)
    }

}